package com.qqtech.qquan.ad.model;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.qqtech.core.common.util.StringUtil;

import net.sf.json.JSONObject;

@SuppressWarnings("serial")
public class AdBaseVo extends AdBase {
	private String typeStr;

	private String communityName;

	public String getTypeStr() {
		return typeStr;
	}

	public void setTypeStr(String typeStr) {
		this.typeStr = typeStr;
	}

	public String getBigPathImg() {
		if (StringUtil.isBlank(this.getImg())) {
			return "";
		}
		return this.getImgHandleDomain() + this.getImg();
	}

	public String getImgs() {
		return getPathImg();
	}

	public String getPathImg() {
		if (StringUtil.isBlank(this.getImg())) {
			return "";
		}
		return this.getImgHandleDomain() + this.getImg();
	}

	public String getPathTitleImg() {
		if (StringUtil.isBlank(this.getTitleImg())) {
			return "";
		}
		return this.getImgHandleDomain() + this.getTitleImg();
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

	public String getCommunityName() {
		return communityName;
	}

	public void setCommunityName(String communityName) {
		this.communityName = communityName;
	}

	public Integer getShopId() {
		if (StringUtil.isBlank(getJsonData())) {
			return 0;
		} else {
			JSONObject jsStr = JSONObject.fromObject(getJsonData());
			if (jsStr.containsKey("shopId")) {
				return jsStr.getInt("shopId");
			} else {
				return 0;
			}
		}
	}
}